﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace l1cs.server.serverpackets
{
    public class S_MPUpdate : ServerBasePacket
    {
        public S_MPUpdate( int currentmp, int maxmp )
        {
            writeC( Opcodes.S_OPCODE_MPUPDATE );

            if ( currentmp < 0 )
            {
                writeH( 0 );
            }
            else if ( currentmp > 32767 )
            {
                writeH( 32767 );
            }
            else
            {
                writeH( currentmp );
            }

            if ( maxmp < 1 )
            {
                writeH( 1 );
            }
            else if ( maxmp > 32767 )
            {
                writeH( 32767 );
            }
            else
            {
                writeH( maxmp );
            }

            // writeH(currentmp);
            // writeH(maxmp);
            // writeC(0);
            // writeD(GameTimeController.getInstance().getGameTime());
        }

        override
        public byte[] getContent()
        {
            return getBytes();
        }

        override public String getType()
        {
            return "[S] S_MPUpdate";
        }
    }
}
